XFont and Font Manager Support ------------------------------ You can now use the font commands built into BASIC for accessing the font manager. Text printed with the PLOT TEXT command will be in the user-specified font while text printed with the PRINT statement will still be in the default font. The BASIC commands for font handling are: def setfont(fontname$) sub askfont(fontname$) def setfontsize(pointsize) sub askfontsize(pointsize) def setfontstyle(style$) sub askfontstyle(style$) The "set" statements return TRUE or FALSE depending on whether or not the font could be loaded. To get an idea of the different formats for font specification, run the program "glsfonts.tru" in this directory to list the GL fonts and the program "xlsfonts" to list the X fonts. (see note below on how to use the output from these programs to set the associated font.) *** FONT SIZE --------- For portability, you should always set the font size. The font size is a point size NOT a pixel size so that 75 dpi (dots per inch) and 100 dpi displays can be supported by the same setfontsize statement. Using the output from the "*lsfonts" programs: The only time when the fontsize should not be set is when you are using the entire font name for X windows in the form that it is returned by "xlsfonts". In this case, the fontsize should be set to zero (the default for X) where it will be treated as a wildcard value. The style should be set to null. *** FONT STYLE ---------- The font managers are case sensitive. The SG font manager accepts styles such as "BoldItalic" while the X font manager handles the same style in the format "bold-i". For portability, the style may be set in the form "<weight>,<slant>". Roman, Italic, and Oblique slants will be converted to the eqivalent r,i,o for the X manager. For the SG manager, they will simply be combined. For example, the statement "call setfontstyle("Bold,Italic")" will be translated to "BoldItalic" for the SG and "bold-i" for X. However, the statement "call setfontstyle("bold,italic")" will have the same effect for X, but for the SG the resulting "bolditalic" will be different from "BoldItalic" and may not be found. *** SETTING THE FONT ---------------- Asking the font, size, or style after setting them will return the null string if the font could not be loaded. You can pass an entire font name consisting of family name, size, and style to the "setfont" subroutine. In this way, you can access the other font fields supported by X. *** DEFAULTS -------- The default font size for the GL is 12 while the X default size is set to 0 (which is translated to be a wildcarded size). The GL loads the font with a single pixel size that is scaled to the font point size by True BASIC (using fmscale). For the GL, unset fields will be left blank. For X, unset fields will be wildcarded. *** To see a list of the availiable X fonts, type: "xlsfonts". The program "glsfonts" in this directory lists the GL fonts. *** WARNING ------- IMPORTANT NOTE: some fonts names which are listed by "glsfonts" (fmenumerate) cause core dumps when loaded and set by the font manager. Using the following if/then statement will avoid this problem. See the example "fontdemo.tru". ! skip fonts we don't want ! these fonts cause memory-faults and core dumps if f$<>"vxms" and f$<>"xif" and f$<>"vsgn" and f$<>"vsg" and f$<>"stan" and f$<>"mit" and f$<>"chp" and f$<>"Cursor" and f$<>"Icon" and f$<>"arrow" and f$<>"chess" then call setfont(f$) end if 11/10/91
Documentation